#include <iostream>
#include <unistd.h>
#include <pthread.h>

using namespace std;

void *Count(void* args)
{
    pthread_detach(pthread_self());

    uint64_t num = (uint64_t)args;

    while(true)
    {
        cout << "num is : " << num << endl;
        sleep(1);
    }

    return nullptr; 
}

int main()
{
    for(uint64_t i = 0; i < 5; i++)
    {
        pthread_t tid;
        pthread_create(&tid,nullptr,Count,(void* )i);//这里i不需要&，需要传的是它的拷贝。
    }

    while(1) sleep(1);

    return 0;
}